package com.smz.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.smz.entity.Customer;
import com.smz.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CustomerController {

    @Autowired
    CustomerService customerService;

    @GetMapping("/customers/{current}/{size}")
    public ResponseEntity<IPage<Customer>> findCustomer(@PathVariable("current")int current, @PathVariable("size")int size){
        return ResponseEntity.ok(customerService.findCustomerBySuppName(current,size));
    }
    @GetMapping("/customers/{current}/{size}/{address}/{name}")
    public ResponseEntity<IPage<Customer>> likeCustomer(@PathVariable("current")int current, @PathVariable("size")int size, @PathVariable("name")String name, @PathVariable("address") String address){
        return ResponseEntity.ok(customerService.selectCustomerLike(current,size,name,address));
    }
}
